gnttab: fix releasing of memory upon switches between versions
authorJan Beulich <jbeulich@suse.com>
Tue, 4 Dec 2012 18:38:00 +0000 (18:38 +0000)
committerJan Beulich <jbeulich@suse.com>
Tue, 4 Dec 2012 18:38:00 +0000 (18:38 +0000)
commit23d9492080ae7ce6e281b6ccae1ecff9d4d9ea3a
tree5860c6e1e08256c7638c082eedf30b3b9fe5f07b
parent9a8913176113eacff0f236c247d6e1bb244afdd9
gnttab: fix releasing of memory upon switches between versions

gnttab_unpopulate_status_frames() incompletely freed the pages
previously used as status frame in that they did not get removed from
the domain's xenpage_list, thus causing subsequent list corruption
when those pages did get allocated again for the same or another purpose.

Similarly, grant_table_create() and gnttab_grow_table() both improperly
clean up in the event of an error - pages already shared with the guest
can't be freed by just passing them to free_xenheap_page(). Fix this by
sharing the pages only after all allocations succeeded.

This is CVE-2012-5510 / XSA-26.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
xen/common/grant_table.c